package com.uci.scheduleshare.calendar;

import java.io.Serializable;
import java.util.List;

import android.content.SharedPreferences;
/**
 * CS 190 Spring 2012
 * Contact.java
 * A contact object that holds all of the contact information
 * and a list of events associated with the contact
 * @author Patrick Hsu, Lauren Ko, Pomi Park
 *
 */
public class Contact implements Serializable{
	
	private static final long serialVersionUID = 1L;
	private String username;
	private Boolean checked;
	private String calendarName;
	private int id;
	private List<Event> events;
	private int color;
	private Boolean isMe;
	
	/**
	 * Contact constructor
	 */
	public Contact(String username, String calendarName, int id, List<Event> events, int color, boolean isMe) {
		this.username = username;
		this.calendarName = calendarName;
		this.id = id;
		this.events = events;
		this.color = color;
		this.isMe = isMe;
		if(isMe) { // If the contact is the user, set default checked to true
			checked = true;
		} else {
			checked = false;
		}
	}
	
	/**
	 * Get name
	 * @return the username of the contact
	 */
	public String getName() {
		return username;
	}
	
	/**
	 * is the contact checked?
	 * @return a boolean
	 */
	public Boolean isChecked() { 
		return checked;
	}

	/**
	 * get the calendar name
	 * @return the calendar name of the contact
	 */
	public String getCalendarName() {
		return calendarName;
	}
	
	/**
	 * Get the ID
	 * @return the contact's ID
	 */
	public int getID() {
		return id;
	}

	/**
	 * Get all the events associated to the contact
	 * @return a List of Events
	 */
	public List<Event> getEvents() {
		return events;
	}
	
	/**
	 * Set the events associated to the contact
	 * @param events
	 */
	public void setEvents(List<Event> events) {
		this.events = events;
	}
	
	/**
	 * Set the ID of the contact
	 * @param id
	 */
	public void setID(int id) {
		this.id = id;
	}
	
	/**
	 * Set the checked value of the contact
	 * @param checked
	 */
	public void setChecked(Boolean checked) {
		this.checked = checked;
	}
	
	/**
	 * Set the color of the contact's events
	 * @param color
	 */
	public void setColor(int color) {
		this.color = color;
	}
	
	/**
	 * Get the color of the contact's events
	 * @return an int representing the contact's color
	 */
	public int getColor() {
		return color;
	}
	
	/**
	 * Set the username of the contact
	 * @param username
	 */
	public void setUsername(String username) {
		this.username = username;
	}
	
	/**
	 * Set the calendar name of the contact
	 * @param calendarname
	 */
	public void setCalendarName(String calendarname) {
		this.calendarName = calendarname;
	}
	
	/**
	 * Check if the contact is the user
	 */
	public boolean isMe() {
		return isMe;
	}
}
